(function() {
    document.getElementById("petworkManagement").onclick = function() {
        autoLogin();
    }
    document.getElementById("personnelManagement").onclick = function() {
        autoLogin();
    }
    document.getElementById("commissionsManagement").onclick = function() {
        autoLogin();
    }
})()

var autoLogin = function() {
    var params = {
        "userID": "chn0007140".toUpperCase(),
        "password": "citicpru1"
    };
    httpPostAutoLogin("openIE:http://128.232.9.222:9081/cmsmot/ActionLoginGXUams.jsp", params);
}

//发送POST请求实现自动登陆
var httpPostAutoLogin = function(URL, PARAMS) {

    var temp = document.createElement("form");
    temp.action = URL;
    temp.method = "post";
    temp.enctype = "application/x-www-form-urlencoded";

    var doTypeElement = document.createElement("input");
    doTypeElement.setAttribute("name", "doType");
    doTypeElement.setAttribute("id", "doType");
    doTypeElement.setAttribute("value", "doLogin");
    doTypeElement.setAttribute("type", "hidden");
    temp.appendChild(doTypeElement);
    for (var x in PARAMS) {
        var opt = document.createElement("input");
        opt.setAttribute("name", x);
        opt.setAttribute("id", x);
        opt.setAttribute("value", PARAMS[x]);
        temp.appendChild(opt);
    }
    document.body.appendChild(temp);
    temp.submit();
}